﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Jzy.Core.Common;
using FortuneHeaven.Entity.NetBar;
using FortuneHeaven.DAL.NetBar;
using Jzy.Core.Admin;

namespace FortuneHeaven.BLL.NetBar
{
    public class UserExBO : CommonOperate<UserExInfo>
    {
        private UserExDAL _userEx;
        private UserBO _user;

        public UserExBO()
        {
            _userEx = new UserExDAL();
            _user = new UserBO();
        }

        public override UserExInfo GetInfo(object id)
        {
            UserExInfo info = base.GetInfo(id);

            if (info != null)
            {
                info.GetUserInfo = userID => _user.GetInfo(userID);
            }

            return info;

        }

        public override List<UserExInfo> GetList(PagerSetting pager, params object[] conditionParas)
        {
            List<UserExInfo> list = base.GetList(pager, conditionParas);

            List<UserInfo> userList = _user.GetList(list.Select(T => T.ID));

            foreach (UserExInfo user in list)
            {
                user.UserInfo = userList.Where(T => T.ID == user.ID).First();
            }

            return list;
        }
    }
}
